home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-06-03 | 7.9 KB | 249 lines | [TEXT/MPS ] |
- {
- File: URLAccess.p
-
- Contains: URL Access Pascal interfaces.
-
- Version: 1.0
-
- Copyright: © 1998 by Apple Computer, Inc., all rights reserved
-
- Bugs?: Please include the the file and version information (from above) with
- the problem description. Developers belonging to one of the Apple
- developer programs can submit bug reports to:
-
- devsupport@apple.com
-
- }
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT URLAccess;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED __URLACCESS__}
- {$SETC __URLACCESS__ := 1}
-
- {$I+}
- {$SETC URLAccessIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
-
- {$IFC UNDEFINED __TYPES__}
- {$I Types.p}
- {$ENDC}
- {$IFC UNDEFINED __FILES__}
- {$I Files.p}
- {$ENDC}
- {$IFC UNDEFINED __CODEFRAGMENTS__}
- {$I CodeFragments.p}
- {$ENDC}
-
- { Data structures and types }
-
- {$PUSH}
- {$ALIGN MAC68K}
- {$LibExport+}
-
-
- TYPE
- URLReference = ^LONGINT;
-
-
- CONST
- kURLReplaceExistingFlag = $01;
- kURLBinHexFileFlag = $02; { Binhex before uploading if necessary }
- kURLExpandFileFlag = $04; { Use StuffIt engine to expand file if necessary }
- kURLDisplayProgressFlag = $08;
- kURLDisplayAuthFlag = $10; { Display auth dialog if guest connection fails }
- kURLUploadFlag = $20; { Do an upload instead of a download }
- kURLIsDirectoryHintFlag = $40; { Hint: the URL is a directory }
- kURLDoNotTryAnonymousFlag = $80; { Don't try to connect anonymously before getting logon info }
- kURLDirectoryListingFlag = $0100; { Download the directory listing, not the whole directory }
- kURLReservedFlag = $80000000; { reserved for Apple internal use }
-
-
- TYPE
- URLOpenFlags = UInt32;
-
- CONST
- kURLNullState = 0;
- kURLInitiatingState = 1;
- kURLLookingUpHostState = 2; { NOT IN EXT HEADER }
- kURLConnectingState = 3; { NOT IN EXT HEADER }
- kURLResourceFoundState = 4;
- kURLDownloadingState = 5;
- kURLDataAvailableState = $15;
- kURLTransactionCompleteState = 6;
- kURLErrorOccurredState = 7;
- kURLAbortingState = 8;
- kURLCompletedState = 9;
- kURLUploadingState = 10;
-
-
- TYPE
- URLState = UInt32;
-
- CONST
- kURLInitiatedEvent = 1;
- kURLResourceFoundEvent = 4;
- kURLDownloadingEvent = 5;
- kURLAbortInitiatedEvent = 8;
- kURLCompletedEvent = 9;
- kURLErrorOccurredEvent = 7;
- kURLDataAvailableEvent = $15;
- kURLTransactionCompleteEvent = 6;
- kURLUploadingEvent = 10;
- kURLSystemEvent = 29;
- kURLPercentEvent = 30;
- kURLPeriodicEvent = 31;
- kURLPropertyChangedEvent = 32;
-
-
- TYPE
- URLEvent = UInt32;
-
- CONST
- kURLInitiatedEventMask = $01;
- kURLResourceFoundEventMask = $08;
- kURLDownloadingMask = $10;
- kURLUploadingMask = $0200;
- kURLAbortInitiatedMask = $80;
- kURLCompletedEventMask = $0100;
- kURLErrorOccurredEventMask = $40;
- kURLDataAvailableEventMask = $00100000;
- kURLTransactionCompleteEventMask = $20;
- kURLSystemEventMask = $10000000;
- kURLPercentEventMask = $20000000;
- kURLPeriodicEventMask = $40000000;
- kURLPropertyChangedEventMask = $80000000;
- kURLAllBufferEventsMask = $00100020;
- kURLAllNonBufferEventsMask = $E00003D1;
- kURLAllEventsMask = $FFFFFFFF;
-
-
- TYPE
- URLEventMask = UInt32;
- URLCallbackInfoPtr = ^URLCallbackInfo;
- URLCallbackInfo = RECORD
- version: UInt32;
- urlRef: URLReference;
- property: ConstCStringPtr;
- currentSize: UInt32;
- systemEvent: EventRecordPtr;
- END;
-
- { http and https properties }
- { authentication type flags }
-
- CONST
- kUserNameAndPasswordFlag = $00000001;
-
- FUNCTION URLGetURLAccessVersion(VAR returnVers: UInt32): OSStatus;
- {$IFC TARGET_RT_MAC_CFM }
- {
- URLAccessAvailable() is a macro/inline available only in C/C++.
- To get the same functionality from pascal or assembly, you need
- to test if URLGetURLAccessVersion function is not NULL. For instance:
-
- gURLAccessAvailable = FALSE;
- IF @URLAccessAvailable <> kUnresolvedCFragSymbolAddress THEN
- gURLAccessAvailable = TRUE;
- END
-
- }
- {$ENDC} {TARGET_RT_MAC_CFM}
-
-
- TYPE
- {$IFC TYPED_FUNCTION_POINTERS}
- URLNotifyProcPtr = FUNCTION(userContext: UNIV Ptr; event: URLEvent; VAR callbackInfo: URLCallbackInfo): OSStatus;
- {$ELSEC}
- URLNotifyProcPtr = ProcPtr;
- {$ENDC}
-
- {$IFC TYPED_FUNCTION_POINTERS}
- URLSystemEventProcPtr = FUNCTION(userContext: UNIV Ptr; VAR event: EventRecord): OSStatus;
- {$ELSEC}
- URLSystemEventProcPtr = ProcPtr;
- {$ENDC}
-
- URLNotifyUPP = UniversalProcPtr;
- URLSystemEventUPP = UniversalProcPtr;
-
- CONST
- uppURLNotifyProcInfo = $00000FF0;
- uppURLSystemEventProcInfo = $000003F0;
-
- FUNCTION NewURLNotifyProc(userRoutine: URLNotifyProcPtr): URLNotifyUPP;
- {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
- INLINE $2E9F;
- {$ENDC}
-
- FUNCTION NewURLSystemEventProc(userRoutine: URLSystemEventProcPtr): URLSystemEventUPP;
- {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
- INLINE $2E9F;
- {$ENDC}
-
- FUNCTION CallURLNotifyProc(userContext: UNIV Ptr; event: URLEvent; VAR callbackInfo: URLCallbackInfo; userRoutine: URLNotifyUPP): OSStatus;
- {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
- INLINE $205F, $4E90;
- {$ENDC}
-
- FUNCTION CallURLSystemEventProc(userContext: UNIV Ptr; VAR event: EventRecord; userRoutine: URLSystemEventUPP): OSStatus;
- {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
- INLINE $205F, $4E90;
- {$ENDC}
- FUNCTION URLSimpleDownload(url: ConstCStringPtr; VAR destination: FSSpec; destinationHandle: Handle; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
- FUNCTION URLDownload(urlRef: URLReference; VAR destination: FSSpec; destinationHandle: Handle; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
- FUNCTION URLSimpleUpload(url: ConstCStringPtr; {CONST}VAR source: FSSpec; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
- FUNCTION URLUpload(urlRef: URLReference; {CONST}VAR source: FSSpec; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
- FUNCTION URLNewReference(url: ConstCStringPtr; VAR urlRef: URLReference): OSStatus;
- FUNCTION URLDisposeReference(urlRef: URLReference): OSStatus;
- FUNCTION URLOpen(urlRef: URLReference; VAR fileSpec: FSSpec; openFlags: URLOpenFlags; notifyProc: URLNotifyProcPtr; eventRegister: URLEventMask; userContext: UNIV Ptr): OSStatus;
- FUNCTION URLAbort(urlRef: URLReference): OSStatus;
- FUNCTION URLGetDataAvailable(urlRef: URLReference; VAR dataSize: Size): OSStatus;
- FUNCTION URLGetBuffer(urlRef: URLReference; VAR buffer: UNIV Ptr; VAR bufferSize: Size): OSStatus;
- FUNCTION URLReleaseBuffer(urlRef: URLReference; buffer: UNIV Ptr): OSStatus;
- FUNCTION URLGetProperty(urlRef: URLReference; property: ConstCStringPtr; propertyBuffer: UNIV Ptr; bufferSize: Size): OSStatus;
- FUNCTION URLGetPropertySize(urlRef: URLReference; property: ConstCStringPtr; VAR propertySize: Size): OSStatus;
- FUNCTION URLSetProperty(urlRef: URLReference; property: ConstCStringPtr; propertyBuffer: UNIV Ptr; bufferSize: Size): OSStatus;
- FUNCTION URLGetCurrentState(urlRef: URLReference; VAR state: URLState): OSStatus;
- FUNCTION URLGetError(urlRef: URLReference; VAR urlError: OSStatus): OSStatus;
-
- FUNCTION URLIdle: OSStatus;
- FUNCTION URLGetFileInfo(fName: StringPtr; VAR fType: OSType; VAR fCreator: OSType): OSStatus;
-
- { Error Codes }
-
- CONST
- kURLInternetAccessErrorCodeBase = -30770;
- kURLInvalidURLReferenceError = -30770;
- kURLProgressAlreadyDisplayedError = -30771;
- kURLDestinationExistsError = -30772;
- kURLInvalidURLError = -30773;
- kURLUnsupportedSchemeError = -30774;
- kURLServerBusyError = -30775;
- kURLAuthenticationError = -30776;
- kURLPropertyNotYetKnownError = -30777;
- kURLUnknownPropertyError = -30778;
- kURLPropertyBufferTooSmallError = -30779;
- kURLUnsettablePropertyError = -30780;
- kURLInvalidCallError = -30781;
- kURLFileEmptyError = -30783;
- kURLExtensionFailureError = -30785;
- kURLInvalidConfigurationError = -30786;
- kURLAccessNotAvailableError = -30787;
-
- {$ALIGN RESET}
- {$POP}
-
- {$SETC UsingIncludes := URLAccessIncludes}
-
- {$ENDC} {__URLACCESS__}
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-